#include <string>
#include <iostream>
#include <fstream>
using namespace std;

int main()
{
	string line;
	//文本getline.txt只有三行
	ifstream file("getline.txt");
	getline(file,line);
	cout<<"第一行:"<<line<<endl;
	getline(file,line);
	cout<<"第二行:"<<line<<endl;
	if(getline(file,line))
	{
		cout<<"第三行:"<<line<<"eof="<<file.eof()<<endl;//此时file.eof()==0
	}

	if(getline(file,line))                          //getline读到末尾返回值为0
	{
		cout<<"第四行:"<<line<<endl;
	}
	cout<<"eof="<<file.eof()<<endl;
	return 0;
}
